kmpkg_check_linkage(ONLY_STATIC_LIBRARY)

kmpkg_from_gitee(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO "kumo-hub/LinuxTracepoints"
    REF "v${VERSION}"
    SHA512 43aff523f2bc43bc46e8c20c60d118c5541d62f597b058796a553c9f04f5c0e4b0de7d06d129fe766afa6b2121a1f0d52ac88b05969bff6390c5f511a37e3f09
    HEAD_REF main)

kmpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
    FEATURES
        tools  BUILD_TOOLS
)

kmpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}/libtracepoint-control-cpp"
    OPTIONS ${FEATURE_OPTIONS}
        -DBUILD_SAMPLES=OFF
)

kmpkg_cmake_install()
kmpkg_copy_pdbs()
kmpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

if (BUILD_TOOLS)
    kmpkg_copy_tools(
        TOOL_NAMES perf-collect
        AUTO_CLEAN)
endif()

kmpkg_cmake_config_fixup(
    PACKAGE_NAME tracepoint-control
    CONFIG_PATH lib/cmake/tracepoint-control)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
